<!--  -->
<template>
  <div class="update-photo">

   
  </div>
 
</template>

<script>
import { updateUserProfile } from '@/api/user'

export default {
  name:'UpdatePhoto',
  components: {},
  props:{
    value:{
      type:[String,Object],
      require:true
    }
  },
  data () {
  return {
     
      
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
   async onConfirm(value){

    console.log(value)
     this.$toast.loading({
       message:'保存中',
       forbidClick:true  //禁止背景点击
     })
  const  datetime1=dayjs(value).format('YYYY-MM-DD')
    console.log(datetime1);
     try {
       const {data}=await updateUserProfile({
        
       birthday:datetime1
     })
      this.$toast.success('保存成功')
      // this.$emit('update-name',this.localName)
     this.$emit('input',datetime1)
     //更新成功->修改父组件->关闭弹出层
     this.$emit('close')
       
     } catch (error) {
         if(error&&error.response&&error.response.status===409){
            this.$toast.fail('呢称已存在')
         }
     }
     
    }
  }
}

</script>
<style lang='less' scoped>
.name-field-wrap{
  padding: 10px;
}
</style>